Skip to content

Vismach: Fix axes colors in class HalCoordsFromNormalAndDirection() - #4928

Closed
Sigma1912 wants to merge 1 commit into
LinuxCNC:masterfrom
Sigma1912:vismach_fix_HalCoords_color
Closed

Sigma1912 wants to merge 1 commit into
LinuxCNC:masterfrom
Sigma1912:vismach_fix_HalCoords_color

Conversation

@Sigma1912

Copy link
Copy Markdown
Contributor

The Z axis indicator should be blue but gets the previous color applied in the model. This is caused by glMaterialfv() being called AFTER gluCylinder() inside draw_vector().

This moves glMaterialfv() BEFORE gluCylinder() and fixes the axes colors.

Comment thread lib/python/vismach.py
Comment on lines +514 to +518
self.draw_vector([0,0,1,1]) # Z axis
glRotate(90,0,1,0)
self.draw_vector([0,1,0,1])
self.draw_vector([1,0,0,1]) # X axis
glRotate(-90,1,0,0)
self.draw_vector([0,0,1,1])
self.draw_vector([0,1,0,1]) # Y axis

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this save and restore the material, like Color does? As it is, the last arrow colour (now green, before this PR blue) carries over to any sibling drawn after it without a Color wrapper.

Suggested change
self.draw_vector([0,0,1,1]) # Z axis
glRotate(90,0,1,0)
self.draw_vector([0,1,0,1])
self.draw_vector([1,0,0,1]) # X axis
glRotate(-90,1,0,0)
self.draw_vector([0,0,1,1])
self.draw_vector([0,1,0,1]) # Y axis
glPushAttrib(GL_LIGHTING_BIT)
self.draw_vector([0,0,1,1]) # Z axis
glRotate(90,0,1,0)
self.draw_vector([1,0,0,1]) # X axis
glRotate(-90,1,0,0)
self.draw_vector([0,1,0,1]) # Y axis
glPopAttrib()

@Sigma1912

Sigma1912 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Indeed. Thanks!
I have also added this to eb8a4b6

Screenshot from 2026-12-01 17-24-01

Should we close this PR as superseded by #4944 (comment)?

The Z axis indicator should be blue but gets the previous color applied in the model.
This is caused by glMaterialfv() being called AFTER gluCylinder() inside draw_vector().

This moves glMaterialfv() BEFORE gluCylinder() and fixes the axes colors and wraps the
three draw_vector calls with glPushAttrib(GL_LIGHTING_BIT) and glPopAttrib() to avoid
leaking into other primitives.
@Sigma1912
Sigma1912 force-pushed the vismach_fix_HalCoords_color branch from 349af09 to 5e7b03f Compare December 1, 2026 16:52
@grandixximo

Copy link
Copy Markdown
Contributor

Closed as superseeded by #4944

@grandixximo grandixximo closed this Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants